package com.itheima.udp;

import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;

public class Service {
    public static void main(String[] args) throws IOException {
        DatagramSocket ds = new DatagramSocket(10000);
        byte[] b = new byte[1024];

        while (true) {
            DatagramPacket dp = new DatagramPacket(b,b.length);
            ds.receive(dp);
            int length = dp.getLength();

            System.out.println(new String(b,0,length));
        }
    }
}
